<?php
require_once 'pages/TMSFrontPage.inc';
require_once 'phpqrcode/qrlib.php';

class TMSFrontQRCodePage extends TMSFrontPage {
	public function Handle(THttpRequest $request){
		$dest = $this->Application()->FileStoragePath().'/qr-code.png';
		if (!file_exists($dest))
			QRcode::png(file_get_contents($this->Service()->VCardUrl()),$dest,QR_ECLEVEL_M, 2);
		header('Content-Type:image/png');
		echo file_get_contents($dest);
		die;
	}
}